<template id="prompt">
  <div class="ui-modal" role="dialog" v-el:modal>
     <div>
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">{{title}}</h4>
          </div>
          <div class="modal-body">
            <input type="text" class="form-control" v-el:input :placeholder="holder">
          </div>
          <div class="modal-footer">           
 						<v-button theme="primary" class="pull-left" @click="resolve">{{hint}}</v-button>
            <v-button @click="reject">取消</v-button>
          </div>
        </div><!-- /.modal-content -->
      </div>      	
     </div>    
  </div>   
</template>
<script>
  export default { 
		name:"prompt",
    replace: false,      
		props: {
			title: {
				type: String,
				default:""
			},
			content: {
				type: String,
				default:""	
			},
			hint: {
				type: String,
				default: "确认"
			},
			holder: {
				type: String,
				default:""
			}
		},	
    methods: {
			   init() {
					$(this.$els.modal).modal('show'); 
				},			
               hide() {
					$(this.$els.modal).modal('hide'); 
				},		
			   get() {
					return this.$els.input.value;
				},
               resolve() {
					  let content = this.$els.input.value;
					  if(!content) {
							Midway.alert('请填写内容');
							return false;
						}
						this.$dispatch("resolve",content);
                },
               reject() {
						this.$dispatch("reject");
                }
    }
  }
</script>